package com.rdc.qingkou.widget;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.rdc.qingkou.R;

/**
 * Created by asus on 2017/10/29.
 */

public class ProgressDialog {
    public static Dialog createLoadingDialog(Context context) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(R.layout.send_loading, null);
        LinearLayout layout = (LinearLayout) view.findViewById(R.id.dialog_view);

        ImageView imageView = (ImageView) view.findViewById(R.id.img_progressBar);

        Animation animation = AnimationUtils.loadAnimation(context,R.anim.load_animation);
        imageView.setAnimation(animation);


        Dialog progressDialog = new Dialog(context, R.style.loading_dialog);
        progressDialog.setCancelable(false);
        progressDialog.setContentView(layout, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT
        ));
        return progressDialog;

    }
}
